cmake_minimum_required(VERSION 3.31)
project(HeadDemo)
#add_executable(hdemo main.cpp demo.cpp demo.h)

# 源文件比较多

#add_executable(hdemo)
#target_sources(hdemo
#    PRIVATE
#        main.cpp
#        demo.h
#        demo.cpp
#)

add_executable(hdemo)

target_sources(hdemo PRIVATE main.cpp)

#添加库 target=demo
add_library(demox)
target_sources(demox PRIVATE demo.cpp demo.h)
#链接库
target_link_libraries(hdemo PRIVATE demox)